package probes.controller;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import probes.conexioBD.Connexio;

public class ControllerFamilia {
	
	Connexio con = new Connexio();
	
	private String querySql = "SELECT Nombre FROM FAMILIA;";
	
	private ArrayList<String> list = new ArrayList<String>();
	
	public ArrayList<String> nombreFamilia() throws SQLException{
		
		Connection conexio = con.conexioBD();
		
		Statement st = conexio.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
		
		ResultSet rs = st.executeQuery(querySql);
				
		while (rs.next()) {
			String nombre = rs.getString("Nombre");
			list.add(nombre);

		}
		
		return list;
		
		
	}

}
